﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PPI.Entities
{
    public class EUser
    {
        private Int32 m_IdUser;
        private string m_Username;
        private string m_Password;
        private bool m_IsAdministrator;

        public bool IsAdministrator
        {
            get { return m_IsAdministrator; }
            set { m_IsAdministrator = value; }
        }
        public string Username
        {
            get
            {
                return m_Username;
            }
            set { m_Username = value; }
        }
        public string Password
        {
            get
            {
                return m_Password;
            }
            set { m_Password = value; }
        }

        public int Id
        {
            get { return m_IdUser; }
            set { m_IdUser = value; }
        }

        public EUser(string username, string password)
        {
            m_Username = username;
            m_Password = password;
            m_IsAdministrator = false;
            m_IdUser = Int32.MinValue;
        }

        public EUser(string username, string password, bool isAdministrator)
        :this(username,password)
        {
            this.m_IsAdministrator = isAdministrator;
        }
        public EUser(Int32 idUser,string username, string password, bool isAdministrator)
        :this(username,password,isAdministrator)
        {
            m_IdUser = idUser;
        }


        public override bool Equals(object obj)
        {
            if (obj is EUser)
            {
                EUser tmpUser = (EUser)obj;
                return (tmpUser.Username.ToUpper() == m_Username.ToUpper() && tmpUser.Password.ToUpper() == m_Password.ToUpper());
            }
            else
            {
                return false;
            }
        }

    }
}
